package com.act.web;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.act.domain.SaleManagement;
import com.act.domain.SealManagement;
import com.act.dto.Response;
import com.act.service.api.ISaleManagementService;
import com.act.service.api.ISealManagementService;

@RestController
@RequestMapping("seal")
public class SealManagementController {
	
	@Resource
	private ISealManagementService sealManagementService ;
	
    @RequestMapping(value="/get",method=RequestMethod.GET)
    public @ResponseBody List<SealManagement> getAll(){
    	List<SealManagement> list=sealManagementService.getAll();
    	return list;
    }
    
    @RequestMapping(value = "/add",method = RequestMethod.POST)
    @ResponseBody
    public Response add(SealManagement sealManagement) {
    	 try {
    		 sealManagementService.add(sealManagement);
             return Response.success();
         } catch (Exception e) {
           
             return Response.fail();
         }
    }

    @RequestMapping(value = "/delete",method = RequestMethod.POST)
    @ResponseBody
    public Response delete(int id) {
    	 try {
    		 sealManagementService.delete(id);
             return Response.success();
         } catch (Exception e) {
           
             return Response.fail();
         }
    }
    
    @RequestMapping(value = "/update",method = RequestMethod.POST)
    @ResponseBody
    public Response update(SealManagement sealManagement) {
    	 try {
    		 sealManagementService.update(sealManagement);
             return Response.success();
         } catch (Exception e) {
           
             return Response.fail();
         }
    }    
}
